﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using GolSig.Library;

namespace Test.GolSig.Library.GameSpecs
{
    /// <summary>
    /// Summary description for WhenNextingGame
    /// </summary>
    [TestClass]
    public class WhenNextingGame
    {
       

        [TestMethod]
        public void NewBoardPositionShouldBeSet()
        {
            Game game = new Game(new BoardSize( 3,3) );
            Position p01 = new Position ( 0,  1 );
            Position p10 = new Position ( 1,  0 );
            Position p11 = new Position ( 1,  1 );
            Position p12 = new Position ( 1,  2 );
            Position p21 = new Position ( 2,  1 );
            game.Initialize(new CellInfo[] {new CellInfo(  p01, true), 
                                            new CellInfo(  p10, true), 
                                            new CellInfo(  p11, true), 
                                            new CellInfo(  p12, true), 
                                             new CellInfo( p21 , true)});

            game.Next();

            Assert.IsTrue(game.Cell(new Position(0,0)).Alive);
            Assert.IsTrue(game.Cell(p01).Alive);
         
            Assert.IsTrue(game.Cell(p10).Alive);
            Assert.IsFalse(game.Cell(p11).Alive);
            Assert.IsTrue(game.Cell(p12).Alive);
            Assert.IsTrue(game.Cell(new Position(2, 0)).Alive);
            Assert.IsTrue(game.Cell(p21).Alive);
            Assert.IsTrue(game.Cell(new Position(2, 2)).Alive);
        }
    }
}
